import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:homemedia/page/tv/home/top_bar.dart';
import 'package:homemedia/page/widget/custom_single_child_scroll_view.dart';
import 'package:homemedia/page/widget/video_scroll_view.dart';

import 'logic.dart';

class HomePage extends StatelessWidget {
  HomePage({super.key});

  final logic = Get.put(HomeLogic());
  final state = Get.find<HomeLogic>().state;

  @override
  Widget build(BuildContext context) {
    // var ch = <Widget>[];
    // ch.add(Text(
    //   '点击了 ${state.count} 次',
    //   style: const TextStyle(fontSize: 30.0),
    // ));
    // for (var i = 0; i < 5; i++) {
    //   // ch.add(Text('点击了 $i 次'));
    //   ch.add(VideoScrollView(title: "title $i", librarylist: state.librarylist));
    // }

    return Scaffold(
      // backgroundColor: Colors.grey.withOpacity(0.8),
      body: Stack(
        children: [
          // ListView(children: ch),
          Obx(() => ListView.builder(
              itemCount: state.librarylist.length,
              itemBuilder: (context, index) {
                return VideoScrollView(title: "title $index", librarylist: state.librarylist);
              }
          )),
          const TopBar(),
        ],
      )
    );
  }

}

Widget streamBuildScrollInfoList({required List<Widget> children}) {
  return Expanded(
    child: CustomSingleChildScrollView(
      child: Column(children: children),
    ),
  );
}


